package by.scsbsu.resources.managers;

import java.util.ResourceBundle;

public class PoolManager {
	
	public static final String DB_POOL_CONFIG_BUDLE = "by.scsbsu.resources.db_pool_config";
	
	public final String POOL_NAME;
	public final String DB_URL;
	public final String DB_USER;
	public final String DB_PASSWORD;
	public final String DB_DRIVER;
	public final int    MIN_POOL;
	public final int    MAX_POOL;
	public final int    MAX_SIZE;
	public final long   IDLE_TIMEOUT;
	
	static ResourceBundle resourceBundle;
	
	public PoolManager() {
		PoolManager.resourceBundle = 
    		ResourceBundle.getBundle(DB_POOL_CONFIG_BUDLE);
		
		POOL_NAME = resourceBundle.getString("name");
		DB_URL = resourceBundle.getString("dbPool.url");
		DB_USER = resourceBundle.getString("dbPool.user");
		DB_PASSWORD = resourceBundle.getString("dbPool.password");
		DB_DRIVER = resourceBundle.getString("drivers");
		MIN_POOL = Integer.parseInt(resourceBundle.getString("dbPool.minpool"));
		MAX_POOL = Integer.parseInt(resourceBundle.getString("dbPool.maxpool"));
		MAX_SIZE = Integer.parseInt(resourceBundle.getString("dbPool.maxsize"));
		IDLE_TIMEOUT = Long.parseLong(resourceBundle.getString("dbPool.idleTimeout"));
	}

}
